<?php
namespace Home\Controller;
use Think\Controller;
class SalesController extends Controller {
    public function index(){
        $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>！</p><br/>[ 您现在访问的是Home模块的Index控制器 ]</div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
    }
 public   function create_password($pw_length = 8)
{
    $randpwd = '';
    for ($i = 0; $i < $pw_length; $i++) 
    {
        $randpwd .= chr(mt_rand(97, 122)).chr(mt_rand(48,57));
    }
    return $randpwd;
}
    
    public function add(){
          if(IS_POST){
		
	  $map['s_ip']=I('cpname');
          $map['s_size']=I('cpsize');
          $map['s_database']='data'.date('Ymd');
          $map['s_datapass']=R('Sales/create_password',array(8));
          $map['s_ftpname']='ftp'.date('Ymd');
          $map['s_ftppass']=R('Sales/create_password',array(8));
          $time=I('time');
          $map['s_stattime']=date('Y-m-d');          
          $map['s_endtime']=date('Y-m-d',strtotime($time.' month'));
        dump($map);
          $user=M('sales');
        $user->data($map)->add();
          } else{

           $this->display();
                     }             	
		}
    public function lists(){
            $user=M('sales');
       $list=$user->select();
                 $this->assign('list',$list);
		$this->display();
		
		}
}
